package org.example.demo09231;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.sql.SQLException;

@SpringBootApplication
public class Demo09231Application {

    public static void main(String[] args) {

        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:mysql://localhost:3306/jdbc");
        dataSource.setUsername("root");
        dataSource.setPassword("050810");
        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        try {
            if (dataSource!= null){
                System.out.println("连接成功");

            }
            else {
                System.out.println("连接失败");
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
    }


